<?php



namespace App\Http\Requests\ApiV2;

use Illuminate\Support\Facades\Auth;

class PlanRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:120',
            'thumb' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输放计划标题'),
            'thumb.required' => __('请输入计划的封面'),

        ];
    }

    public function filldata()
    {

        $user = Auth::user();
        return [
            'user_id'=>(int)$user['id'],
            'title' =>(string) $this->input('title'),
            'start_at' =>$this->input('start_at'),
            'is_hide' =>(int) $this->input('is_hide',0),
            'thumb' =>(string) $this->input('thumb'),
            'days'=>(int)$this->input('days'),

        ];
    }
}
